<?php
/**
* This file holds a class for Application_Model_Color.
* @package busmap
*/

/**
* This class holds Application_Model_Color class, that manipulates with Color objects.
* @package busmap
*/
class Application_Model_Color
{
    protected $_name;
    protected $_redValue;
    protected $_greenValue;
    protected $_blueValue;
    protected $_id;
  
	/**
	* Constructor with optional options array.
	*/
    public function __construct(array $options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
		$this->_redValue = 255;
		$this->_greenValue = 255;
		$this->_blueValue = 255;
    }
 
	/**
	* Universal setter function that gets a name and a value for the Color object property.
	*/
    public function __set($name, $value){
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid BusStop property');
        }
        $this->$method($value);
    }
	/**
	* Universal getter function that gets the value of a Color property with the given name.
	*/
    public function __get($name){
	       $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid BusStop property');
        }
        return $this->$method();
	}
 
 	/**
	* Setter function for the name property.
	*/
    public function setName($name){
		$this->_name = $name;
		return $this;
	}
	/**
	* Getter function for the name property.
	*/
    public function getName(){
		return $this->_name;
	}
 
 	/**
	* Setter function for the redValue property.
	*/
    public function setRedValue($redValue){
		$this->_redValue = $redValue;
		return $this;
	}
	/**
	* Getter function for the redValue property.
	*/
    public function getRedValue(){
		return $this->_redValue;
	}
 
 	/**
	* Setter function for the greenValue property.
	*/
    public function setGreenValue($greenValue){
		$this->_greenValue = $greenValue;
		return $this;
	}
	/**
	* Getter function for the greenValue property.
	*/
    public function getGreenValue(){
		return $this->_greenValue;
	}

 	/**
	* Setter function for the blueValue property.
	*/
    public function setBlueValue($blueValue){
		$this->_blueValue = $blueValue;
		return $this;
	}
	/**
	* Getter function for the blueValue property.
	*/
    public function getBlueValue(){
		return $this->_blueValue;
	}
 
 	/**
	* Setter function for the id property.
	*/
    public function setId($id){
		$this->_id = $id;
		return $this;
	}
	/**
	* Getter function for the id property.
	*/
    public function getId(){
		return $this->_id;
	}

	/**
	* Function that returns an array with the property values of this object.
	*/
	public function toArray(){
		$result = array();
		$result['id'] = $this->getId();
		$result['name'] = $this->getName();
		$result['redValue'] = $this->getRedValue();
		$result['greenValue'] = $this->getGreenValue();
		$result['blueValue'] = $this->getBlueValue();
		return $result;
	}
}
 
